﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FacilityController : MonoBehaviour
{
    public static FacilityController Instance;
    //[System.NonSerialized]
    //public SystemEdit systemEdit;

    private UnityEngine.Object objPlot, objComputer;
    private Transform parentZone, parentComputer;

    public Dictionary<int, Dictionary<int, GameObject>> dicPlots = new Dictionary<int, Dictionary<int, GameObject>>();
    [System.NonSerialized]
    public List<GameObject> computers = new List<GameObject>();

    private void Awake()
    {
        Instance = this;
        objPlot = Resources.Load("Area");
        parentZone = GameObject.Find("Zone").transform;
        Init();
    }
    // Start is called before the first frame update
    void Start()
    {
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void Init()
    {
        InitTest();
    }

    public void InitTest()
    {
        for (int i = 0; i < 20; i++)
        {
            dicPlots.Add(i, new Dictionary<int, GameObject>());
            for (int j = 0; j < 28; j++)
            {
                GameObject go = (GameObject)Instantiate(objPlot, new Vector3(i * 0.5f, 0, j * 0.5f), Quaternion.identity, parentZone);
                go.GetComponent<UnitPlot>().SetCoordinate(i, j);
                dicPlots[i].Add(j, go);
            }
        }
    } 
}